package com.ruoyi.project.jzfqw.re;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.sell.customer.domain.SellCustomer;
import com.ruoyi.project.system.user.domain.User;
import com.ruoyi.project.system.user.service.IUserService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@RequestMapping("user/user")
@Controller
public class RyContorller extends BaseController {

    @Autowired
    private IUserService userService;

    //声明公共资源前缀
    private String prefix = "jzfqw/ry";
    //声明公共资源
    @GetMapping
    @RequiresPermissions("user:user:view")
    public String userConn(){
        return prefix+"/ryda";
    }

    @RequiresPermissions("system:user:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(User user)
    {
        startPage();
        List<User> list = userService.selectUserList(user);
        return getDataTable(list);
    }

    //声明添加的公共资源
    @GetMapping("/add")
    @RequiresPermissions("user:user:add")
    public String userAdd(){
        return prefix+"/add";
    }

    //声明添加的公共资源
    @GetMapping("/edit")
    public String userEdit(){
        return prefix+"/edit";
    }
}
